﻿using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dal
{
    public class MenuDal
    {
        public MenuDal(BabyfaceEntities _db)
        {
            db = _db;
        }
        public BabyfaceEntities db { get; set; }

        public IList<Menu> GetAll()
        {
            var list = db.Menu.ToList();
            return list;
        }
        public DataSet GetMenuByRoleId(int RoleId)
        {
            SqlParameter[] parms = {
                new SqlParameter("@RoleId", SqlDbType.Int, 4)
            };
            parms[0].Value = RoleId;
            return db.Database.DataSet(CommandType.StoredProcedure, "PGetMenuByRoleId", parms);
        }
    }
}
